var pageii = null;
var grid = null;
$(function() {
	
	grid = lyGrid({
		pagId : 'paging',
		l_column : [ {
			colkey : "id",
			name : "id",
			hide : true
		}, {
			colkey : "code",
			name : "物料编号",
		}, {
			colkey : "name",
			name : "物料名称",
		}, {
			colkey : "specification",
			name : "物料规格",
		}],
		jsonUrl : rootPath + '/item_resource/getItemFindByPage.shtml',
		dymCol:true,
		checkbox : true,
		checkValue: "id",
		records: "list",
		totalPages: "pages",
		totalRecords: "total",
		pagecode: '10',
		pageNow : 'pageNum'
	});


	//根据下拉框选取物料

	$("#material").change(function() {

		var sel = $("#material option:selected").val();//获取下拉框数据
		if(sel == 0){
			$("#searchForms").val("0")
			var searchParams = $("#searchForms").serializeJson();
			grid.setOptions({
				data : searchParams
			});
		}else if (sel == 2) {
			$("#searchForms").val("2")
			var searchParams = $("#searchForms").serializeJson();
			grid.setOptions({
				data : searchParams
			});
		}else if(sel == 3){
			$("#searchForms").val("3")
			var searchParams = $("#searchForms").serializeJson();
			grid.setOptions({
				data : searchParams
			});
		}else if(sel == 5){
			$("#searchForms").val("5")
			var searchParams = $("#searchForms").serializeJson();
			grid.setOptions({
				data : searchParams
			});
		}else{
			$("#searchForms").val("1")
			var searchParams = $("#searchForms").serializeJson();
			grid.setOptions({
				data : searchParams
			});
		}
	});

});